package ro.pub.cs.ncit.bluetoothtutorial;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.UUID;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class BluetoothListAdapter extends BaseAdapter {
	private List<BluetoothDevice> devices;

	private Context context;

	public BluetoothListAdapter(List<BluetoothDevice> devices, Context context) {
		this.devices = devices;
		this.context = context;
	}

	@Override
	public int getCount() {
		return this.devices.size();
	}

	@Override
	public Object getItem(int arg0) {
		return this.devices.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		LayoutInflater inflater = (LayoutInflater) this.context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rootView = inflater.inflate(R.layout.item_layout, arg2, false);

		TextView deviceName = (TextView) rootView
				.findViewById(R.id.device_name);
		TextView deviceAddress = (TextView) rootView
				.findViewById(R.id.device_address);
		
				return rootView;
	}
}
